home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 October
/
EnigmA AMIGA RUN 22 (1997)(G.R. Edizioni)(IT)[!][issue 1997-10 & 11][EAR-CD VI].iso
/
recent2
/
mbenchdm.lha
/
mbench
/
Install-MBench
< prev
next >
Wrap
Text File
|
1997-07-04
|
12KB
|
481 lines
; $VER: MBench install 1.0
; English language
;
;
; Copyright (C) Mark Hewitt.
;
; Set TABS to 4
;
; BUGS
; Problems when there is already a version of MBench installed.
;
; First we have the text strings for translation.
;-----------------------------------------------------------------
; ### variable declarations
(set #ProgName "MBench")
(set #DiskName "MBench")
(set #HDSpaceNeededBytes (* (* 1 1024) 300)) ; 300K Free
(set #ImagesDest "SYS:Classes/Images")
;-----------------------------------------------------------------
; ### string declaration
;// Drawer names
(set #DrawerName "MBench")
(set #StartMenuDrawerName "StartMenu")
(set #WorkspaceDrawerName "WorkSpace")
(set #ModulesDrawerName "Modules")
(set #ExtrasDrawerName "Extras")
;// File names
(set #HelpFileName "MBench.Guide")
(set #ReadMeName "ReadMeFirst")
(set #OrderFormName "OrderForm")
;-----------------------------------------------------------------
;// Message strings
(set #CheckStartup
(cat "\n\n\nPlease wait...\n\nThe installer is just checking your system.")
)
(set #WorkingMsg (cat "Please wait...\n\nInstalling " #ProgName))
(set #BadKick
(cat #ProgName " requires Workbench 2.04 or above to work correctly.")
)
(set #introduction
(cat "Welcome to the MBench installation procedure.\nThis utility will"
"enable you to simply install MBench onto your system.\n"
"Simply follow the instructions and click help for more information at any stage."
)
)
(set #DestChoicePrompt
(cat "\n\n\nWhere would you like to install " #ProgName "?")
)
(set #HardDiskDestChoiceMsg
(cat "Where do you want to install the\n" #ProgName " drawer?")
)
(set #HardDiskDestChoiceHelp
(cat "Select the drawer where you want to install " #ProgName
", then click Proceed (a new drawer titled \"" #DrawerName
"\" will be created and will contain the " #ProgName " program.)"
)
)
(set #NoDiskSpaceMsg1
(cat "\nThere is insufficient available space on your hard disk to install "
#ProgName ". You will need a minimum of "
)
)
(set #NoDiskSpaceMsg2
(cat "MB of free disk space.\n\nEither click \"Abort Install\" to exit this "
"installation and delete some files from your hard disk, or click \"Proceed\" and try a "
"different partition."
)
)
(set #DrawerExistsMsg
(cat "\nA drawer titled \"" #DrawerName "\" already exists in "
"the destination you have chosen.\n\nDo you wish to replace it "
"or choose a new destination?\n\n"
)
)
(set #DrawerExistsChoice1 "Replace it")
(set #DrawerExistsChoice2 "Choose new destination")
(set #DrawerExistsHelp
(cat "\nYou have chosen a destination drawer which already has \""
#DrawerName "\" installed there.\n\nClick \""
#DrawerExistsChoice1 "\" to replace the contents with this new version "
"of " #ProgName ".\nClick \"" #DrawerExistsChoice2 "\" to choose a "
"new destination drawer.\n\n"
"If you choose \"" #DrawerExistsChoice1 "\" then please make sure you "
"have back up copies of any documents you wish to keep."
)
)
(set #SelectStartMenuIcons "Which icons do you want for the start menu?")
(set #StandardMenuItems "Standard Icons")
(set #MagicMenuItems "Magic Menu Icons")
(set #StartMenuIconsHelp
(cat "If you have Magic Menus installed then it is best to install"
"the modified Magic Menu Icons. \nIt is also an idea to "
"Change in the settings the Misc/Show StartMenu Arrows item"
"so that the arrows for sub menus don't look strange."
)
)
(set #AskUserStartUpMsg
(cat "For " #ProgName " to work properly, some assigns have to be added "
"to your 'user-startup' script:\n\n Click proceed to continue."
)
)
(set #AskUserStartUpHelp
(cat "For MBench to work correctly it needs to set up the assigns"
"'MBench:' and 'WorkSpace:'.\n\n"
"Click Proceed if you want the installer to do this automatically, "
"or click 'Skip This Part' to not modify the user-startup."
)
)
;------------------------------------------------------
; ### Procedure declarations
;------------------------------------------------------
; ### First some general routines.
;------------------------------------------------------
;// Initial Checks
(procedure @InitialChecks
(
;// Check OS version
(working #CheckStartup)
(set #OSVerNum (getversion))
(set #OSVersion (/ #OSVerNum 65536))
(if (< #OSVersion 37)
(abort #BadKick)
)
; Set this here as in some instances we need to get a response from the
; user if the worst comes to the worse and change mode to something
; else to get an input. See @ChooseHDDest for an example.
(set #UserNovice 0)
(if (= @user-level 0)
(
(set #UserNovice 1)
)
)
)
)
;### Choose hard disk destination for MBench
(procedure @ChooseHDDest
(
;** Find default drawer
(set #DefaultDest (getassign "Work" "d"))
(if (= #DefaultDest "")
(
(set #DefaultDest (getassign "HD3" "d"))
(if (= #DefaultDest "")
(
(set #DefaultDest (getassign "HD2" "d"))
(if (= #DefaultDest "")
(
(set #DefaultDest (getassign "HD1" "d"))
(if (= #DefaultDest "")
(
(set #DefaultDest (getassign "DH1" "d"))
(if (= #DefaultDest "")
(
(set #DefaultDest (getassign "HD0" "d"))
(if (= #DefaultDest "")
(
(set #DefaultDest "DH0:")
(if (= #DefaultDest "")
(
; ## No default available so force to select one.
(if (= #UserNovice 1)
(user 2)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
;** Ask for destination the destination drawer.
(set #DestDrawer
(askdir
(prompt #HardDiskDestChoiceMsg)
(help #HardDiskDestChoiceHelp)
(default #DefaultDest)
)
)
;## incase we were forced to change mode above, change back.
(if (= #UserNovice 1)
(user 0)
)
)
)
;------------------------------------------------------
;### Procedure to check if MBench exists already in destination
;### Replace or choose again if so
(procedure @CheckExistsAlready
(
(if (exists (tackon #DestDrawer #DrawerName))
(
(set ChooseAgainAnswer
(askbool
(prompt #DrawerExistsMsg)
(choices #DrawerExistsChoice1 #DrawerExistsChoice2)
(help #DrawerExistsHelp)
(default 1)
)
)
(if (= ChooseAgainAnswer 0)
(
(set MMExists 0)
)
(
(set MMExists 1)
)
);endif
)
(;else
(set MMExists 1)
)
);endif
)
)
;------------------------------------------------------
;### Find HD Destination and check enough space
(procedure @FindHDDest
(
;## loop untill we get a drawer that doesn't already exist.
(set MMExists 0)
(while (= MMExists 0)
(
(@ChooseHDDest)
(while (< (getdiskspace #DestDrawer) #HDSpaceNeededBytes)
(
(if (< (getdiskspace #DestDrawer) #HDSpaceNeededBytes)
(
; ## if there was an error we must change mode to try and
; ## get the user to rectify the problem.
(if (= @user-level 0)
(
(user 2)
(set #UserNovice 1)
)
)
(message #NoDiskSpaceMsg1 (/ (/ #HDSpaceNeededBytes 1024) 1024) #NoDiskSpaceMsg2)
(@ChooseHDDest)
)
)
)
) ;end while
;## check if it already exists.
(@CheckExistsAlready)
)
);end while
;## incase we were forced to change mode above, change back.
(if (= #UserNovice 1)
(user 0)
)
)
)
;------------------------------------------------------
;### And some specific routines.
;
;// Create any drawers that are necessary.
(procedure @CreateDrawers
(
(working #WorkingMsg)
;// Make the main MBench drawer
(set #InsideHDDest (tackon #DestDrawer #DrawerName))
(makedir #InsideHDDest (infos))
)
)
;
;// And install all files.
(procedure @InstallFiles
(
(working #WorkingMsg)
;### And install all the files.
; First MBench
(copyfiles
(source "")
(choices #ProgName #HelpFileName #ReadMeName #OrderFormName "AddToStartSequence" #ModulesDrawerName #WorkSpaceDrawerName )
(dest #InsideHDDest)
(infos)
(optional "force")
)
; set which start menu items we want to use.
(set ChooseAgainAnswer
(askbool
(prompt #SelectStartMenuIcons)
(choices #MagicMenuItems #StandardMenuItems)
(help #StartMenuIconsHelp)
(default 0)
)
)
(if (= ChooseAgainAnswer 0)
(
(copyfiles
(source "")
(choices "StartMenuStandard")
(dest #InsideHDDest)
(infos)
(optional "force")
)
(rename (tackon #InsideHDDest "StartMenuStandard") (tackon #InsideHDDest "StartMenu"))
(rename (tackon #InsideHDDest "StartMenuStandard.info") (tackon #InsideHDDest "StartMenu.info"))
))
(if (= ChooseAgainAnswer 1)
(
(copyfiles
(source "")
(choices "StartMenuMagicMenu")
(dest #InsideHDDest)
(infos)
(optional "force")
)
(rename (tackon #InsideHDDest "StartMenuMagicMenu") (tackon #InsideHDDest "StartMenu"))
(rename (tackon #InsideHDDest "StartMenuMagicMenu.info") (tackon #InsideHDDest "StartMenu.info"))
))
; And the prefs program.
(copyfiles
(source "MBPrefs")
(dest "sys:Prefs")
(infos)
)
; Now all libraries
(copylib
(source "libs/mbmisc.library")
(dest "LIBS:")
)
; Now copy files to other places, such as the images and 'C:' commands
; First do the images.
(if (NOT (exists "ram:classes" (noreq) ))
(makedir "ram:Classes" (infos))
)
(if (NOT (exists "ram:classes/images" (noreq) ))
(makedir "ram:Classes/Images" (infos))
)
(copyfiles
(source "Images")
(all)
(dest "ram:Classes/Images")
(infos)
(optional "force")
)
; And the c commands.
(copyfiles
(source "Utilities/MBCommand")
(dest "C:")
(infos)
(optional "force")
)
; delete old config files.
(delete "ENV:sys/mbench.config")
(delete "ENVARC:sys/mbench.config")
; now set any startup-sequence assigns etc.
;Set up any assigns
(startup #ProgName
(prompt #AskUserStartUpMsg)
(help #AskUserStartUpHelp)
(command (cat"C:Assign >NIL: MBench: " #InsideHDDest "\n"))
(command (cat"C:Assign >NIL: WorkSpace: " #WorkSpaceDest "\n"))
)
(run (cat "Assign >NIL: MBench: " #InsideHDDest))
(run (cat "Assign >NIL: WorkSpace: " #WorkSpaceDest))
; NOTE THAT WE CHANGE USER MODE HERE to always get a response!!!!!
(user 2)
(set ChooseAgainAnswer
(askbool
(prompt "Do you want MBench automatically run on start up instead of Workbench?")
(help (cat "If you like MBench then why not have it run on start up every time. "
"If you select yes then it will remove the old lines from the "
"S:Startup-Sequence and add a line to run MBench instead.\n"
"If you would just like to test MBench first instead then select no "
"and if you change your mind later then just run the AddToStartSequence "
"program to automatically run it at a later date.\n"))
(default 0)
)
)
(if (= ChooseAgainAnswer 1)
(
(run "MBench:AddToStartSequence")
)
);endif
)
)
;------------------------------------------------------
; ### Main
(complete 0)
(welcome)
(message #introduction)
(complete 5)
;### gets a dest and makes sure that there is enough space and that either
;### it doesn't already exist or it is OK to overwrite it.
(@FindHDDest)
(complete 20)
;### makes the actual drawers.
(@CreateDrawers)
(set @default-dest #DestDrawer)
(complete 30)
;### and copy the files over.
(@InstallFiles)
(complete 100)
(exit)